package com.ruoyi.workSafetyStandardization.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.workSafetyStandardization.mapper.DeductMapper;
import com.ruoyi.workSafetyStandardization.domain.Deduct;
import com.ruoyi.workSafetyStandardization.service.IDeductService;

/**
 * 评分-扣分项Service业务层处理
 *
 * @author pengjie
 * @date 2023-12-15
 */
@Service
public class DeductServiceImpl implements IDeductService
{
    @Autowired
    private DeductMapper deductMapper;

    /**
     * 查询评分-扣分项
     *
     * @param deductId 评分-扣分项主键
     * @return 评分-扣分项
     */
    @Override
    public Deduct selectDeductByDeductId(String deductId)
    {
        return deductMapper.selectDeductByDeductId(deductId);
    }

    /**
     * 查询评分-扣分项列表
     *
     * @param deduct 评分-扣分项
     * @return 评分-扣分项
     */
    @Override
    public List<Deduct> selectDeductList(Deduct deduct)
    {
        return deductMapper.selectDeductList(deduct);
    }

    /**
     * 新增评分-扣分项
     *
     * @param deduct 评分-扣分项
     * @return 结果
     */
    @Override
    public int insertDeduct(Deduct deduct)
    {
        deduct.setCreateByName(SecurityUtils.getUsername());
        deduct.setCreateAt(new Date());
        deduct.setCreateBy(SecurityUtils.getUserId().toString());
        return deductMapper.insertDeduct(deduct);
    }

    /**
     * 修改评分-扣分项
     *
     * @param deduct 评分-扣分项
     * @return 结果
     */
    @Override
    public int updateDeduct(Deduct deduct)
    {
        return deductMapper.updateDeduct(deduct);
    }

    /**
     * 批量删除评分-扣分项
     *
     * @param deductIds 需要删除的评分-扣分项主键
     * @return 结果
     */
    @Override
    public int deleteDeductByDeductIds(String[] deductIds)
    {
        return deductMapper.deleteDeductByDeductIds(deductIds);
    }

    /**
     * 删除评分-扣分项信息
     *
     * @param deductId 评分-扣分项主键
     * @return 结果
     */
    @Override
    public int deleteDeductByDeductId(String deductId)
    {
        return deductMapper.deleteDeductByDeductId(deductId);
    }
}
